package me.qixiaobo.tran.annotation;

import com.fasterxml.jackson.annotation.JacksonAnnotationsInside;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import me.qixiaobo.enums.BaseEnum;
import me.qixiaobo.tran.core.FieldTranStrategy;
import me.qixiaobo.tran.core.TranStrategy;
import me.qixiaobo.tran.core.handler.TranslationHandler;

import java.lang.annotation.*;

/**
 * 通用翻译注解
 *
 * @author bo
 */
@Inherited
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.METHOD})
@Documented
@JacksonAnnotationsInside
@JsonSerialize(using = TranslationHandler.class)
public @interface Translation {

    /**
     * 枚举类的父类
     * @return
     */
    Class<? extends BaseEnum> enumClazz();

    /**
     * 规则字段,json格式的
     */
    String jsonStr() default "{}";

    /**
     * 字段内容翻译执行器
     * @return
     */
    FieldTranStrategy tranStrategy() default FieldTranStrategy.FROM_ENUM;
}
